import store from "../store";
// 递归寻找之后返回所需按钮权限判断
export function canFunc(funcAlias) {
    var routers = [];
    formatConversion(store.getters.permission_routers, routers);
    var index = routers.findIndex(router => {
        return router.perms == funcAlias && router.hidden === 1
    })
    return index >= 0;
}

// 递归
function formatConversion(list, routers) {
    if (list) {
        list.forEach(item => {
            if (item.perms != '' && item.perms != undefined) {
                routers.push(item);
            }
            formatConversion(item.children, routers)
        })
    }
}
